home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / SampleSMSAMDETemplate / GenericAddress.r next >
Encoding:
Text File  |  1995-07-28  |  9.3 KB  |  295 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        GenericAddress.r
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __TYPES__
  15. #include "Types.r"
  16. #endif
  17.  
  18. #ifndef __OCE.R__
  19. #include "OCE.r"
  20. #endif
  21.  
  22. #ifndef __OCE__
  23. #include "OCE.h"
  24. #endif
  25.  
  26. #ifndef __OCETEMPLATES__
  27. #include "OCETemplates.h"
  28. #endif
  29.  
  30.  
  31.  
  32. // our properties ########################################################################
  33.  
  34. #define kXtnType            kDETFirstDevProperty
  35. #define kPrDNodeNumber        (kDETFirstDevProperty+1)
  36. #define kPrDirName            (kDETFirstDevProperty+2)
  37. #define kPrDirDiscA            (kDETFirstDevProperty+3)
  38. #define kPrDirDiscB            (kDETFirstDevProperty+4)
  39. #define kPrPart1            (kDETFirstDevProperty+5)
  40. #define kPrPart2            (kDETFirstDevProperty+6)
  41. #define kPrPart3            (kDETFirstDevProperty+7)
  42. #define kPrNumOfPathParts    (kDETFirstDevProperty+8)
  43. #define kPrCidSource         (kDETFirstDevProperty+9)            /* long 00000000*/ 
  44. #define kPrCidSequence         (kDETFirstDevProperty+10)            /* long 00000000*/ 
  45. #define kPrEntityName         (kDETFirstDevProperty+11) 
  46. #define kPrEnitiyType         (kDETFirstDevProperty+12)             /* RSrting " User" */
  47. #define kPrAddress             (kDETFirstDevProperty+13)             // Inet Address RString
  48.  
  49.  
  50.  
  51. // type declarations that we need ########################################################
  52.  
  53. // here's a convenience type declaration for defining our 'detb' resource
  54. // if you want to use this to set up an address template for your personal
  55. // MSAM, you all you should have to change is the resource 'detb' declaration,
  56. // not this type
  57.  
  58. type 'detb' {
  59.     longInt;                                                // address type (you fill in)
  60.     integer = (end1-start1)/8;                                // length of all data following
  61. start1:
  62.     longInt;                                                // address type (you fill in)
  63.     integer = (endPRID-startPRID)/8;                        // length of packed recordid
  64. startPRID:
  65.     integer = (endRLI-startRLI)/8;                            // length of packed rli
  66. startRLI:
  67.     longInt = 0;                                            // dNode # (0)
  68.     rstring;                                                // directory name (you fill in)
  69.     align word;
  70.     longInt;                                                // discriminator A (you fill in)
  71.     longInt = 0;                                            // discriminator B
  72.     integer = (endPackedPath-startPackedPath)/8;            // packed pathname size
  73. startPackedPath:
  74.     integer = 3;                                            // # of pathname parts (3)
  75.     longInt = 0;                                            // path part 1 (0)
  76.     longInt = 0;                                            // path part 2 (0)
  77.     longInt = 0;                                            // path part 3 (0)
  78. endPackedPath:
  79. endRLI:
  80.     longInt = 0;                                            // CreationID source (0)
  81.     longInt = 0;                                            // CreationID seq (0)
  82.     rstring;                                                // name RString (you fill in)
  83.     align word;
  84.     rstring;                                                // type RString (you fill in)
  85.     align word;
  86. endPRID:
  87.     rstring;                                                // extension value (you fill in)
  88.     align word;
  89. end1:    
  90. };
  91.  
  92.  
  93.  
  94. // template ID ranges ##################################################################
  95.  
  96. // note that we used resource IDs starting way up at 5000, since this template
  97. // will be rezzed into an MSAM which also has a setup template, so we don't want
  98. // to use the same DET resource ID space
  99.  
  100. #define kAddressAspect            (5000)                // aspect
  101. #define kAddressInfoPage        (5000+kDETIDSep)    // info page
  102. #define kAddressRecordType        kUserRecTypeBody
  103.  
  104.  
  105.  
  106. // information specific to your address template #######################################
  107.  
  108. #include "SpecificAddress.r"
  109.  
  110.  
  111. // aspect template (used for both main and info page aspects) ###########################
  112.  
  113. // 'deta' this is a aspect template
  114. resource 'deta' (kAddressAspect, purgeable) { 0, dropCheckConflicts, isMainAspect };
  115.  
  116. // template name
  117. resource 'rstr' (kAddressAspect+kDETTemplateName, purgeable) {
  118.     kAspectTemplateName
  119. };
  120.  
  121. // the kind is address
  122. resource 'rstr' (kAddressAspect+kDETAspectKind, purgeable) {
  123.     kAspectKind
  124. };
  125.  
  126. // new menu name
  127. resource 'rstr' (kAddressAspect+kDETAspectNewMenuName, purgeable) {
  128.     kNewMenuName
  129. };
  130.  
  131. // this template apply to the kMailSlotsAttrTypeBody attribute
  132. resource 'rstr' (kAddressAspect+kDETAttributeType, purgeable) {
  133.     kMailSlotsAttrTypeBody
  134. };
  135.  
  136. // tag of attribute this applies to
  137. resource 'detn' (kAddressAspect+kDETAttributeValueTag)
  138. {
  139.     kSignature
  140. };
  141.  
  142. #if 1
  143. resource 'detn' (kAddressAspect + kDETAspectSublistOpenOnNew)
  144. {
  145.     1
  146. };
  147. #endif
  148.  
  149. // category for template
  150. resource 'rst#' (kAddressAspect+kDETAspectCategory, purgeable) {
  151.     {kDETCategoryAddressItems}
  152. };
  153.  
  154. // dett attribute look up table
  155. // if you want to change this table, do change kDETAspectNewValue detb to match the new table
  156. // the table is for a personal MSAM address with an RString as the extension value
  157. resource 'dett' (kAddressAspect+kDETAspectLookup, purgeable)
  158.     {{
  159.         {kMailSlotsAttrTypeBody},
  160.         kSignature,
  161.         useForInput,    
  162.         useForOutput, 
  163.         notInSublist,    
  164.         isNotAlias,isNotRecordRef,
  165.         // mailslot attribute
  166.         { 
  167.         
  168.             //                                        unused fields here
  169.         
  170.             /* generic stuff (no changes needed) */
  171.             
  172.             'wsiz',                                 kDETNoProperty,    0;         // length of indented data
  173.             '((((',                                    kDETNoProperty,    0;
  174.                 'long', kXtnType,                                       0;         // extension type
  175.                 'wsiz',                                kDETNoProperty,    0;         // packed record ID length
  176.                 '((((',                                kDETNoProperty,    0;         
  177.                     'wsiz',                            kDETNoProperty,    0;        // RLI length
  178.                     '((((',                            kDETNoProperty,    0;        
  179.                         'long', kPrDNodeNumber,                        0;        // dNode # (0 for us)
  180.                         'rstr', kPrDirName,                            0;        // directory name
  181.                         'awrd', kDETNoProperty,                        0;
  182.                         'long', kPrDirDiscA,                        0;        // directory disc 1 (our signature)
  183.                         'long', kPrDirDiscB,                        0;        // directory disc 2 (0L)
  184.                         'wsiz', kDETNoProperty,                     0;
  185.                         '((((', kDETNoProperty,                        0;        // packed pathname length
  186.                             'word', kPrNumOfPathParts,                0;        // # of parts (3)
  187.                             'rstr', kPrPart1,                        0;        // part 1 ("")
  188.                             'awrd',                 kDETNoProperty,    0;        
  189.                             'rstr', kPrPart2,                        0;        // part 2 ("")
  190.                             'awrd',                    kDETNoProperty,    0;
  191.                             'rstr', kPrPart3,                        0;        // part 3 ("")
  192.                             'awrd',                    kDETNoProperty,    0;
  193.                         '))))',                        kDETNoProperty,    0;
  194.                     '))))',                            kDETNoProperty,    0;
  195.                     'long', kPrCidSource,                             0;        // creation ID source 
  196.                     'long', kPrCidSequence,                         0;        // creation ID seq
  197.                     'rstr', kDETAspectName,                         0;         // name of this address (RString)
  198.                     'awrd',                         kDETNoProperty,    0;
  199.                     'rstr', kPrEnitiyType,                             0;         // entity type (apple-User)
  200.                     'awrd',                         kDETNoProperty, 0;
  201.                 '))))',                                kDETNoProperty,    0;
  202.                 
  203.                 /* specific address information */
  204.                 
  205.                 'rstr', kPrAddress,                                 0;             // your address (RString)
  206.                 'awrd',                         kDETNoProperty,    0;
  207.                 
  208.             '))))',                                    kDETNoProperty,    0;        
  209.             
  210.             'Pref',                                    kDETNoProperty,    0        // save pref mailslot (built-in code)
  211.         };
  212.     }};
  213.  
  214.  
  215. // info-page template #################################################################
  216.  
  217. // item location in inforpage template window
  218.  
  219.  
  220. #define    kNameTop                        (kDETSubpageIconBottom + 8)
  221. #define kNameBottom                        (kNameTop + kDETAppFontLineHeight+4)
  222. #define kAddressTop                        (kNameBottom+8)
  223. #define kAddressBottom                    (kAddressTop + kDETAppFontLineHeight+4)
  224.  
  225. #define kMy1stColumnLeft    (16)
  226. #define kMy1stColumnRight    (100)
  227. #define kMy2ndColumnLeft    (104)
  228. #define kMy2ndColumnRight    (kDETAttributeInfoWindWidth - 16)
  229.  
  230. #define    kAddressInfoPageWidth            ( kMy2ndColumnRight + 16 )
  231. #define    kAddressInfoPageHeigth            (kAddressBottom+8)
  232.  
  233. /***********************************|****************************************/
  234.  
  235. resource 'detw' ( kAddressAspect + kDETAspectInfoPageCustomWindow , purgeable )
  236. {
  237.     { 0, 0, kAddressInfoPageHeigth, kAddressInfoPageWidth },
  238.     discludePopup
  239. };
  240.  
  241. // info page (view) template ('deti')
  242. resource 'deti' (kAddressInfoPage, purgeable) {
  243.     1000,    // template sort order
  244.     { 0, 0, kDETAttributeInfoWindHeight, kDETAttributeInfoWindWidth },
  245.     noSelectFirstText,
  246.     {
  247.     kDETNoProperty, kDETNoProperty, kAddressInfoPage;
  248.     },
  249.     {}
  250. };
  251.  
  252. // this is the name of the InfoPage template, don't use the same name as your aspect name
  253. resource 'rstr' (kAddressInfoPage+kDETTemplateName, purgeable) {
  254.     kInfoPageTemplateName
  255. };
  256.  
  257. // this template applies to the kMailSlotsAttrTypeBody attribute
  258. resource 'rstr' (kAddressInfoPage+kDETAttributeType, purgeable) {
  259.     kMailSlotsAttrTypeBody
  260. };
  261.  
  262. // title of the built-in info page view popup
  263. resource 'rstr' (kAddressInfoPage+kDETInfoPageName, purgeable) {
  264.     kPopUpTitle
  265. };
  266.  
  267. // this is to relate the info page to the right aspect
  268. // this needs to be the same string as the kDETTemplateName of the aspect template
  269. resource 'rstr' (kAddressInfoPage+kDETInfoPageMainViewAspect, purgeable) {
  270.     kAspectTemplateName
  271. };
  272.  
  273.  
  274. // our view resource.  this defines the locations of the user interface elements
  275. // in the info-page window.
  276. resource 'detv' (kAddressInfoPage, purgeable)
  277. {
  278.     {
  279.         kDETSubpageIconRect, kDETNoFlags, kDETAspectMainBitmap,
  280.         Bitmap { kDETLargeIcon };
  281.  
  282.         {kNameTop, kMy1stColumnLeft, kNameBottom, kMy1stColumnRight}, kDETNoFlags, kDETNoProperty,
  283.         StaticTextFromView { kDETApplicationFont, kDETApplicationFontSize, kDETRight, kDETBold,"Name:" };
  284.  
  285.         {kNameTop, kMy2ndColumnLeft, kNameBottom, kMy2ndColumnRight}, kDETNoFlags, kDETAspectName,
  286.         EditText { kDETApplicationFont, kDETApplicationFontSize, kDETLeft, kDETNormal };
  287.  
  288.         {kAddressTop, kMy1stColumnLeft, kAddressBottom, kMy1stColumnRight}, kDETNoFlags, kDETNoProperty,
  289.         StaticTextFromView { kDETApplicationFont, kDETApplicationFontSize, kDETRight, kDETBold,"Applelink ID:" };
  290.  
  291.         {kAddressTop, kMy2ndColumnLeft, kAddressBottom, kMy2ndColumnRight}, kDETNoFlags, kPrAddress,
  292.         EditText { kDETApplicationFont, kDETApplicationFontSize, kDETLeft, kDETNormal };
  293.     };
  294. };
  295.